package com.suitsoft.ut.dao.info;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Component;
import org.springside.modules.orm.Page;
import org.springside.modules.orm.hibernate.HibernateDao;

import com.suitsoft.ut.entity.info.Info;

/**
 * 用户对象的泛型DAO类.
 * 
 * @author calvin
 */
@Component
public class InfoDao extends HibernateDao<Info, Long> {
	

	@Autowired
	private JdbcTemplate jdbcTemplate;
	// 统一定义所有用户的HQL.
	private static final String QUERY_BY_INFO_HQL = "select infotitle from lw_Info where =?";
	
	public Info loadByTitle(String infoTitle) {
		return findUniqueBy("infoTitle", infoTitle);
	}

	/**
	 * 查找信息在标题中.
	 */
	public List<Info> getInfoByTitle(String infoTitle) {
		return find(QUERY_BY_INFO_HQL, infoTitle);
	}
	

	public Page<Info> getAllInfo(Page<Info> page) {
		String hql = "from Info";
		return findPage(page, hql);
	}
	
}
